#include<iostream>
#include<algorithm>
#include<string>
using namespace std;
const int N = 25;
string a[N];
bool cmp(string& x, string& y)
{
	return x + y > y + x;
}
int main()
{
	//贪心
	int n = 0;
	cin >> n;
	//数字直接用string类型来接收就可以了
	for (int i = 1;i <= n;i++)
	{
		cin >> a[i];
	}
	sort(a + 1, a + n + 1,cmp);
	for (int i = 1;i <= n;i++)
	{
		cout << a[i];
	}
	return 0;
}